package com.yonyou.pmclouds.safetypatrol.process;

import com.yonyou.pmclouds.basecom.bp.processor.SingleProcessor;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.safetypatrol.entity.SafetypatrolDetailVO;
import com.yonyou.pmclouds.safetypatrol.mapper.SafetypatrolDetailMapper;

/**
 * @author 徐老板
 * @date 2020/4/17   10:37
 */

public class SafetypatrolDetailUpdateCheckProcess implements SingleProcessor<SafetypatrolDetailVO> {

    private SafetypatrolDetailMapper detailMapper;

    public SafetypatrolDetailUpdateCheckProcess(SafetypatrolDetailMapper detailMapper) {
        this.detailMapper = detailMapper;
    }


    @Override
    public void process(SafetypatrolDetailVO vo, SafetypatrolDetailVO orig) throws BusinessException {
        if (vo!=null){
          Integer count=  detailMapper.checkDetailRepeat(vo);
          if (count!=null && count>0){
              throw new BusinessException("该检查项名称重复, BuziExCodeConst.CODE_NAME_BEEN_USED");
          }
        }
    }
}
